﻿<%@ Page Title="" Language="C#" MasterPageFile="~/Site.Master" AutoEventWireup="true" CodeBehind="Profile.aspx.cs" Inherits="BlackEagleClient.Profile" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
<div id="addFriend"><asp:ImageButton ID="btnFriendReq" runat="server" 
        ImageUrl="img/friendreq.jpg" onclick="btnFriendReq_Click" /></div>
    <link href="Styles/Comment.css" rel="stylesheet" type="text/css" />

    <asp:DataList ID="ProfileDataList" runat="server">
    <ItemTemplate>
    <div id="ProfileHeader">
    
    <div id="ProfilePictureCont">

    <img id="ProfilePicture"  src="<%# CheckImg(((string)Eval("PictureUrl")), ((int)Eval("Sex")))  %>" alt="" />
        
    </div>

    <div id="ProfileIntro">
    <h2><asp:label ID="NameLabel" runat="server"><%# Eval("Fnamn") %>&nbsp;<%# Eval("Enamn")%></asp:label></h2>
    <p><asp:label ID="lblAge"  runat="server" Text="Age: " > </asp:label><asp:label ID="Age" runat="server"><%# CalculateAge(((DateTime)Eval("BirthDate"))) %></asp:label></p>
    <p><asp:label ID="lblSex"  runat="server" Text="Sex: " ></asp:label><asp:label ID="Sex" runat="server"><%# GetSex(((int)Eval("Sex")))%></asp:label></p>
    <fieldset>
    <h3>Personal Description:</h3>
    <p>
    <%# Eval("PersonalDesc") %>
    </p>
    </fieldset>

    </ItemTemplate>
    </asp:DataList>

    <asp:Button ID="DMBtn" runat="server" Text="New DirectMessage" onclick="DMBtn_Click" />

    <asp:Panel ID="DirectMessagePanel" runat="server" Visible="false">
    <ContentTemplate>
       
        <p><asp:Label ID="DirectMessageTitleLabel" runat="server" Text="Title:"></asp:Label><br />

        <asp:TextBox runat="server" ID="DirectMessageTitleTxt"></asp:TextBox>

        <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server"
 ControlToValidate="DirectMessageTitleTxt" 
 CssClass="failureNotification"
 Display="Dynamic"
 ErrorMessage="title cannot be empty"
 ToolTip="title cannot be empty"
 ValidationGroup="dmValidationGroup"
  SetFocusOnError="True">*</asp:RequiredFieldValidator></p>

  <asp:RegularExpressionValidator id="rev2" runat="server"
     SetFocusOnError="True"
     ErrorMessage="Maximum length of title is 85 characters"
     Display="Dynamic"
     ControlToValidate="DirectMessageTitleTxt"
     CssClass="failureNotification"
     ValidationGroup="dmValidationGroup"
     ValidationExpression="^{1,85}$">
</asp:RegularExpressionValidator>

        <p><asp:Label ID="DirectMessageLabel" runat="server" Text="Message:"></asp:Label><br />
        <asp:TextBox runat="server" ID="DirectMessageTxt" Height="100px" Width="500px"></asp:TextBox>
        <asp:RequiredFieldValidator ID="RequiredFieldValidator3" runat="server"
 ControlToValidate="DirectMessageTxt" 
 CssClass="failureNotification"
 Display="Dynamic"
 ErrorMessage="Message cannot be empty"
 ToolTip="Message cannot be empty"
 ValidationGroup="dmValidationGroup"
  SetFocusOnError="True">*</asp:RequiredFieldValidator>
  <asp:RegularExpressionValidator id="RegularExpressionValidator1" runat="server"
     SetFocusOnError="True"
     ErrorMessage="Maximum length of message is 2000 characters"
     Display="Dynamic"
     ControlToValidate="DirectMessageTxt"
     CssClass="failureNotification"
     ValidationGroup="dmValidationGroup"
     ValidationExpression="^{1,2000}$">
</asp:RegularExpressionValidator>
  </p>
        <asp:Button ID="SendDMBtn" runat="server" Text="Send Message" 
            onclick="SendDMBtn_Click" ValidationGroup="dmValidationGroup" /><br />

    </ContentTemplate>
    </asp:Panel>
  

  <asp:Button runat="server" ID="commentButton" Text="Send Comment" OnClick="commentButton_Click" />

    <asp:UpdatePanel ID="CommentsPanel" runat="server">

    <ContentTemplate>

    <asp:ScriptManager ID="ScriptManager1" runat="server"> </asp:ScriptManager>

    <asp:Label runat="server" ID="errorLabel" ForeColor="red"></asp:Label>

    <p><asp:Label runat="server" ID="commentLabel">Comment: </asp:Label>
    <asp:TextBox runat="server" ID="commentTxt"></asp:TextBox></p>

    <fieldset>
    <legend>Comments</legend>
    <asp:DataList ID="commentList" runat="server">
    <ItemTemplate>

    <ul>
    <li>
    <div class="wrap">
    <img class="commentImg" src="<%# CheckImg(((string)Eval("AuthorPicture")), ((int)Eval("Sex")))  %>" alt="No Picture" />
    <div class="comment">
        <p><%# Eval("Name")%></p>
        <p><%# Eval("Message") %></p>
        <p class="date"><%# Eval("SubmitTime")%></p>
    </div>
</div>​
</li>
</ul>

    </ItemTemplate>
    </asp:DataList>
    </fieldset>

    </ContentTemplate>

    </asp:UpdatePanel>
</asp:Content>
